home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / close.c.guide (.txt) < prev    next >
Amigaguide Document  |  1996-10-10  |  1KB  |  29 lines

  1. /* Close.c   V1.0   93-03-15                        */
  2. /* ROM library: "dos.library/Close", (All versions) */
  3. /* Copyright 1993, Anders Bjerin, Amiga C Club      */
  4. #include <dos/dos.h>
  5. #include <clib/dos_protos.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. UBYTE *version = "$VER: Close 1.0";
  9. int main( int argc, char *argv[] );
  10. int main( int argc, char *argv[] )
  11.   BPTR my_file;
  12.   /* Open a new file: */
  13.   my_file = Open( "RAM:Score.dat", MODE_NEWFILE );
  14.   /* OK? */
  15.   if( !my_file )
  16.     /* Could not open the file! */
  17.     printf( "Error! Could not open the file!\n" );
  18.     exit( 20 );
  19.   printf( "File open!\n" );
  20.   /* - - - */
  21.   /* Close the file: */
  22.   if( Close( my_file ) )
  23.     printf( "File closed!\n" );
  24.   else
  25.     printf( "Error! File could not be closed!\n" );
  26.   /* Remember that even if the file could not be */
  27.   /* closed we must NOT try to close it again!   */
  28.   exit( 0 );
  29.